import React, { PureComponent, Fragment } from 'react';
import { connect } from 'dva';
import moment from 'moment';
import BraftEditor from 'braft-editor';
import 'braft-editor/dist/index.css';
import Upload from 'rc-upload';

import {
  Row,
  Col,
  Card,
  Form,
  Input,
  Select,
  Icon,
  Button,
  Dropdown,
  Menu,
  InputNumber,
  DatePicker,
  Modal,
  message,
  Checkbox,
  Radio,
  Badge,
  Divider,
  Tabs,
} from 'antd';
const { RangePicker } = DatePicker;
const { TextArea } = Input;
const confirm = Modal.confirm;
const { TabPane } = Tabs;
import DescriptionList from 'components/DescriptionList';
const { Description } = DescriptionList;
const RadioGroup = Radio.Group;

import {
  articleAdd,
  articleUpdate,
  projectDeclareDetail,
  projectDeclareAudit,
  projectDeclareReview,
} from '../../services/api';
import { getArrFromObj, getToken, getCurrent } from '../../utils/utils';
import config from '../../common/config';

import StandardTable from 'components/StandardTable';
import PageHeaderLayout from '../../layouts/PageHeaderLayout';

import styles from './declareReview.less';

import uploadPng from '../../assets/upload.png';

const FormItem = Form.Item;
const { Option } = Select;
const getValue = obj =>
  Object.keys(obj)
    .map(key => obj[key])
    .join(',');

const PAGE_STATUS_MAP = {
  '0': '无效',
  '1': '有效',
};

const PAGE_STATUS_ARR = getArrFromObj(PAGE_STATUS_MAP);

const PAGE_CATEGORY_MAP = {
  1: '新闻动态',
  2: '政策资讯',
  3: '知产干货',
  4: '关于我们',
};

const PAGE_CATEGORY_ARR = getArrFromObj(PAGE_CATEGORY_MAP);

const STATUS_MAP = {
  0: '暂存',
  1: '待审核',
  2: '审核通过',
  3: '审核不通过',
};

const STATUS_ARR = getArrFromObj(STATUS_MAP);

const PROJECT_TYPE_MAP = {
  0: '非战略咨询类',
  1: '战略咨询类',
};

const PROJECT_TYPE_ARR = getArrFromObj(PROJECT_TYPE_MAP);

const PAGE_SIZE = 10;

const EDUCATION_MAP = {
  1: '大专',
  2: '本科',
  3: '硕士',
  4: '博士',
};

const BASEINFO_PROJECT_TYPE_MAP = {
  1: '基础研究',
  2: '应用研究',
  3: '应用示范',
  4: '孵化项目',
};

@connect(({ declareReview, loading }) => {
  return {
    declareReview,
    loading: loading.models.declareReview,
  };
})
@Form.create()
export default class List extends PureComponent {
  state = {
    modalVisible: false,
    selectedRows: [],
    formValues: {},
    id: null,

    title: null,
    content: '',
    smsProject: {},
    baseInfo: {},
    leaderInfo: {},
    declareUnits: [],
    cooperationUnits: [],
    topicGroup: [],
    additionalInfo: {},

    step: 3,

    imgOptions: {},
    coverUrl: null,

    checkVisible: false,

    reviewStatus: null,
    score: null,
    reviewDesc: null,
    id: null,
  };

  componentDidMount() {
    this.getImgOptions();
    this.init();
  }

  getImgOptions() {
    const token = getToken();

    const imgOptions = {
      action: config.serveraddress + '/upload/putObject?dataType=0',
      data: { dataType: 0 },
      headers: {
        Authorization: 'Bearer ' + token,
      },
      multiple: false,
      beforeUpload(file) {
        console.log('beforeUpload', file.name);
      },
      onStart: file => {
        console.log('onStart', file.name);
      },
      onProgress(step, file) {},
    };

    this.setState({
      imgOptions,
    });
  }

  init() {
    const { dispatch } = this.props;
    dispatch({
      type: 'declareReview/queryList',
      payload: {
        pageNum: 1,
        pageSize: PAGE_SIZE,
      },
    });
  }

  handleStandardTableChange = (pagination, filtersArg, sorter) => {
    const { dispatch } = this.props;
    const { formValues } = this.state;

    const filters = Object.keys(filtersArg).reduce((obj, key) => {
      const newObj = { ...obj };
      newObj[key] = getValue(filtersArg[key]);
      return newObj;
    }, {});

    const params = {
      ...formValues,
      ...filters,
      pageNum: pagination.current,
      pageSize: pagination.pageSize,
    };
    if (sorter.field) {
      params.sorter = `${sorter.field}_${sorter.order}`;
    }

    dispatch({
      type: 'declareReview/queryList',
      payload: params,
    });
  };

  handleFormReset = () => {
    const { form, dispatch } = this.props;
    form.resetFields();
    this.setState({
      formValues: {},
    });
    dispatch({
      type: 'declareReview/queryList',
      payload: {
        pageNum: 1,
        pageSize: PAGE_SIZE,
      },
    });
  };

  handleSelectRows = rows => {
    this.setState({
      selectedRows: rows,
    });
  };

  handleSearch = e => {
    e.preventDefault();

    const { dispatch, form } = this.props;

    form.validateFields((err, fieldsValue) => {
      if (err) return;

      if (fieldsValue.createTime) {
        fieldsValue.startTime =
          moment(fieldsValue.createTime[0]).format('YYYY-MM-DD') + 'T00:00:00Z';
        fieldsValue.endTime = moment(fieldsValue.createTime[1]).format('YYYY-MM-DD') + 'T23:59:59Z';
      }

      delete fieldsValue['createTime'];

      const values = {
        ...fieldsValue,
        pageNum: 1,
        pageSize: PAGE_SIZE,
      };

      dispatch({
        type: 'declareReview/queryList',
        payload: values,
      });
    });
  };

  handleShowModal = e => {
    e.preventDefault();
    this.setState({
      id: null,
      modalVisible: true,
      levelRule: '',
      name: '',
    });
  };

  handleCancel = e => {
    this.setState({
      modalVisible: false,
    });
  };

  async handleSave(e) {
    const {
      title,
      status,
      category,
      author,
      coverUrl,
      pcTitle,
      pcKeywords,
      pcDesc,
      mobileTitle,
      mobileKeywords,
      mobileDesc,
      content,
    } = this.state;
    if (!title) {
      return message.error('请填写文章标题');
    }

    if (!author) {
      return message.error('请填写文章作者');
    }

    if (!category) {
      return message.error('请选择文章分类');
    }

    if (!content) {
      return message.error('请填写文章内容');
    }

    await this.doSave();
  }

  async doSave() {
    const { dispatch } = this.props;

    const {
      id,
      title,
      status,
      category,
      author,
      coverUrl,
      pcTitle,
      pcKeywords,
      pcDesc,
      mobileTitle,
      mobileKeywords,
      mobileDesc,
      content,
    } = this.state;

    let response = {};
    if (id) {
      const params = {
        id,
        title,
        status,
        category,
        author,
        coverUrl,
        pcTitle,
        pcKeywords,
        pcDesc,
        mobileTitle,
        mobileKeywords,
        mobileDesc,
        content: content.toHTML(),
      };
      response = await articleUpdate(params);
    } else {
      const params = {
        title,
        status,
        category,
        author,
        coverUrl,
        pcTitle,
        pcKeywords,
        pcDesc,
        mobileTitle,
        mobileKeywords,
        mobileDesc,
        content: content.toHTML(),
      };
      response = await articleAdd(params);
    }

    if (response.code === 200) {
      this.setState({
        modalVisible: false,
      });

      this.init();
    } else {
      message.error(response.message);
    }
  }

  handleReply(item) {
    this.setState({
      ...item,
      modalVisible: true,
    });
  }

  handleOnchange(field, e) {
    this.setState({
      [field]: e.target.value,
    });
  }

  onChange(field, value, dateString) {
    this.setState({
      [field]: dateString,
    });
  }

  handleSelectOnchange(field, value) {
    this.setState({
      [field]: value,
    });
  }

  onRadioChange(field, e) {
    this.setState({
      [field]: e.target.value,
    });
  }

  async handleView(item) {
    const response = await projectDeclareDetail({
      projectId: item.id,
    });

    this.setState({
      ...response.data,
      modalVisible: true,
    });
  }

  renderForm() {
    return this.renderAdvancedForm();
  }

  renderAdvancedForm() {
    const { getFieldDecorator } = this.props.form;
    return (
      <Form onSubmit={this.handleSearch} layout="inline">
        <Row gutter={{ md: 8, lg: 24, xl: 24 }}>
          <Col md={6} sm={24}>
            <FormItem label="">
              {getFieldDecorator('projectName')(<Input placeholder="项目名称" />)}
            </FormItem>
          </Col>

          <Col md={6} sm={24}>
            <FormItem label="">
              {getFieldDecorator('declareEnter')(<Input placeholder="申报单位" />)}
            </FormItem>
          </Col>

          <Col md={4} sm={24}>
            <FormItem label="">
              {getFieldDecorator('projectType')(
                <Select style={{ width: '100%' }} placeholder="申报类别">
                  {PROJECT_TYPE_ARR.map(item => {
                    return (
                      <Option key={item.id} value={item.id}>
                        {item.name}
                      </Option>
                    );
                  })}
                </Select>
              )}
            </FormItem>
          </Col>

          <Col md={4} sm={24} style={{ padding: '0' }}>
            <FormItem label="">
              {getFieldDecorator('status')(
                <Select style={{ width: '100%' }} placeholder="评审状态">
                  {STATUS_ARR.map(item => {
                    return (
                      <Option key={item.id} value={item.id}>
                        {item.name}
                      </Option>
                    );
                  })}
                </Select>
              )}
            </FormItem>
          </Col>
          <Col md={4} sm={24} style={{ padding: '0' }}>
            <span style={{ float: 'right', marginBottom: 24 }}>
              <Button type="primary" htmlType="submit">
                查询
              </Button>
            </span>
          </Col>
        </Row>
      </Form>
    );
  }

  handleEditorChange = editorState => {
    this.setState({
      content: editorState,
    });
  };

  uploadSuccess(res, field) {
    this.setState({
      [field]: res.data,
    });
  }

  uploadError(res, field) {
    debugger;
  }

  handleTabsChange(step) {
    this.setState({
      step,
    });
  }

  renderStep3({ field }) {
    const { additionalInfo } = this.state;

    return (
      <div>
        <div
          className="text"
          id="content"
          dangerouslySetInnerHTML={{
            __html: additionalInfo[field],
          }}
        />
      </div>
    );
  }

  handleCheck(item) {
    this.setState({
      checkVisible: !this.state.checkVisible,
      reviewStatus: item.reviewStatus,
      score: item.score,
      reviewDesc: item.reviewDesc,
      id: item.id,
    });
  }

  isReadOnly() {
    return this.state.reviewStatus === 4;
  }

  async handleCheckSave() {
    const { id, score, reviewDesc } = this.state;

    if (!score || isNaN(score)) {
      return message.error('请填写得分');
    }
    if (parseInt(score) < 0 || parseInt(score) > 100) {
      return message.error('得分需要在0-100之间');
    }

    if (!reviewDesc) {
      return message.error('请填写评审意见');
    }

    const response = await projectDeclareReview({
      score,
      id,
      reviewDesc,
    });

    this.setState({
      checkVisible: !this.state.checkVisible,
    });
    this.init();
  }

  handleCancel2() {
    this.setState({
      checkVisible: !this.state.checkVisible,
    });
  }

  render() {
    let { declareReview: { data }, loading } = this.props;
    const { getFieldDecorator } = this.props.form;
    const { selectedRows, modalVisible, imgOptions, coverUrl } = this.state;

    const columns = [
      {
        title: '序号',
        dataIndex: 'id',
        render: (val, item, index) => (
          <span>{(data.pagination.current - 1) * data.pagination.pageSize + index + 1}</span>
        ),
      },
      {
        title: '项目名称',
        ellipsis: true,
        width: 100,
        dataIndex: 'projectName',
      },
      {
        title: '申报类别',
        dataIndex: 'projectType',
        render: val => <span>{PROJECT_TYPE_MAP[val]}</span>,
      },
      {
        title: '申报单位',
        dataIndex: 'declareEnter',
        render: val => <span>{val}</span>,
      },
      {
        title: '申报状态',
        dataIndex: 'reviewStatus',
        render: val => <span>{val === 3 ? '待评审' : '已评审'}</span>,
      },
      {
        title: '操作',
        dataIndex: '',
        render: (val, item) => (
          <span>
            <a href="javascript:;" onClick={this.handleView.bind(this, item)}>
              查看申报书
            </a>
            &nbsp;{
              <a href="javascript:;" onClick={this.handleCheck.bind(this, item)}>
                {item.reviewStatus === 3 ? '评审' : '查看评审'}
              </a>
            }
          </span>
        ),
      },
    ];

    return (
      <PageHeaderLayout title="申报评审">
        <Card bordered={false}>
          <div className={styles.tableList}>
            <div className={styles.tableListForm}>{this.renderForm()}</div>
            <StandardTable
              disableSelect={true}
              selectedRows={selectedRows}
              loading={loading}
              data={data}
              columns={columns}
              onSelectRow={this.handleSelectRows}
              onChange={this.handleStandardTableChange}
            />
          </div>
        </Card>

        <Modal
          maskClosable={false}
          width="70%"
          title="详情"
          visible={this.state.modalVisible}
          onOk={this.handleCancel.bind(this)}
          onCancel={this.handleCancel.bind(this)}
        >
          <Row gutter={{ md: 24, lg: 24, xl: 24 }}>
            <Col span={24}>
              <DescriptionList size="large" title="" style={{ width: '100%', margin: '10px' }}>
                <Description term="项目名称">
                  <div style={{ width: 500, fontWeight: 'bold' }}>
                    {this.state.smsProject.projectName}
                  </div>
                </Description>
              </DescriptionList>
            </Col>
          </Row>

          <Row gutter={{ md: 24, lg: 24, xl: 24 }}>
            <Col span={12}>
              <DescriptionList size="large" title="" style={{ width: '100%', margin: '10px' }}>
                <Description term="申报单位">
                  <div style={{ width: 200 }}>{this.state.smsProject.declareEnter}</div>
                </Description>
              </DescriptionList>
            </Col>
            <Col span={12}>
              <DescriptionList size="large" title="" style={{ width: '100%', margin: '10px' }}>
                <Description term="通讯地址">
                  <div style={{ width: 200 }}>{this.state.smsProject.postalAddress}</div>
                </Description>
              </DescriptionList>
            </Col>
          </Row>

          {this.state.smsProject.projectType === 0 && (
            <div>
              <Row gutter={{ md: 24, lg: 24, xl: 24 }}>
                <Col span={12}>
                  <DescriptionList size="large" title="" style={{ width: '100%', margin: '10px' }}>
                    <Description term="项目类别">
                      <div style={{ width: 200 }}>
                        {this.state.baseInfo.projectCategory === 1 ? '重点项目' : '一般项目'}
                      </div>
                    </Description>
                  </DescriptionList>
                </Col>
                <Col span={12}>
                  <DescriptionList size="large" title="" style={{ width: '100%', margin: '10px' }}>
                    <Description term="项目类型">
                      <div style={{ width: 200 }}>
                        {BASEINFO_PROJECT_TYPE_MAP[this.state.baseInfo.projectType]}
                      </div>
                    </Description>
                  </DescriptionList>
                </Col>
              </Row>
              <Row gutter={{ md: 24, lg: 24, xl: 24 }}>
                <Col span={12}>
                  <DescriptionList size="large" title="" style={{ width: '100%', margin: '10px' }}>
                    <Description term="项目预算(万元)">
                      <div style={{ width: 200 }}>{this.state.baseInfo.totalBudget}</div>
                    </Description>
                  </DescriptionList>
                </Col>
                <Col span={12}>
                  <DescriptionList size="large" title="" style={{ width: '100%', margin: '10px' }}>
                    <Description term="申请资助(万元)">
                      <div style={{ width: 200 }}>{this.state.baseInfo.applySupport}</div>
                    </Description>
                  </DescriptionList>
                </Col>
              </Row>
              <Row gutter={{ md: 24, lg: 24, xl: 24 }}>
                <Col span={24}>
                  <DescriptionList size="large" title="" style={{ width: '100%', margin: '10px' }}>
                    <Description term="研究起止日期">
                      <div style={{ width: 400 }}>
                        {moment(this.state.baseInfo.researchStartTime).format('YYYY-MM-DD')} -{' '}
                        {moment(this.state.baseInfo.researchEndTime).format('YYYY-MM-DD')}
                      </div>
                    </Description>
                  </DescriptionList>
                </Col>
                <Col span={12}>
                  <DescriptionList
                    size="large"
                    title=""
                    style={{ width: '100%', margin: '10px' }}
                  />
                </Col>
              </Row>
            </div>
          )}

          {this.state.smsProject.projectType === 1 && (
            <div>
              <Row gutter={{ md: 24, lg: 24, xl: 24 }}>
                <Col span={12}>
                  <DescriptionList size="large" title="" style={{ width: '100%', margin: '10px' }}>
                    <Description term="项目类别">
                      <div style={{ width: 200 }}>
                        {this.state.baseInfo.projectCategory === 1 ? '重点项目' : '一般项目'}
                      </div>
                    </Description>
                  </DescriptionList>
                </Col>
                <Col span={12}>
                  <DescriptionList size="large" title="" style={{ width: '100%', margin: '10px' }}>
                    <Description term="申请经费(万元)">
                      <div style={{ width: 200 }}>{this.state.baseInfo.applyFunds}</div>
                    </Description>
                  </DescriptionList>
                </Col>
              </Row>
              <Row gutter={{ md: 24, lg: 24, xl: 24 }}>
                <Col span={12}>
                  <DescriptionList size="large" title="" style={{ width: '100%', margin: '10px' }}>
                    <Description term="预期成果形式">
                      <div style={{ width: 200 }}>{this.state.baseInfo.expectedResults}</div>
                    </Description>
                  </DescriptionList>
                </Col>
                <Col span={12}>
                  <DescriptionList size="large" title="" style={{ width: '100%', margin: '10px' }}>
                    <Description term="成果字数">
                      <div style={{ width: 200 }}>{this.state.baseInfo.achievementsWords}</div>
                    </Description>
                  </DescriptionList>
                </Col>
              </Row>
              <Row gutter={{ md: 24, lg: 24, xl: 24 }}>
                <Col span={24}>
                  <DescriptionList size="large" title="" style={{ width: '100%', margin: '10px' }}>
                    <Description term="计划完成时间">
                      <div style={{ width: 400 }}>
                        {moment(this.state.baseInfo.planCompletedTime).format('YYYY-MM-DD')}
                      </div>
                    </Description>
                  </DescriptionList>
                </Col>
                <Col span={12}>
                  <DescriptionList
                    size="large"
                    title=""
                    style={{ width: '100%', margin: '10px' }}
                  />
                </Col>
              </Row>
            </div>
          )}

          <Divider orientation="left">项目负责人信息</Divider>

          {this.state.smsProject.projectType === 0 && (
            <div>
              <Row gutter={{ md: 24, lg: 24, xl: 24 }}>
                <Col span={12}>
                  <DescriptionList size="large" title="" style={{ width: '100%', margin: '10px' }}>
                    <Description term="姓名">
                      <div style={{ width: 200 }}>{this.state.leaderInfo.leaderName}</div>
                    </Description>
                  </DescriptionList>
                </Col>
                <Col span={12}>
                  <DescriptionList size="large" title="" style={{ width: '100%', margin: '10px' }}>
                    <Description term="性别">
                      <div style={{ width: 200 }}>
                        {this.state.leaderInfo.gender === 1 ? '男' : '女'}
                      </div>
                    </Description>
                  </DescriptionList>
                </Col>
              </Row>

              <Row gutter={{ md: 24, lg: 24, xl: 24 }}>
                <Col span={12}>
                  <DescriptionList size="large" title="" style={{ width: '100%', margin: '10px' }}>
                    <Description term="出生年月">
                      <div style={{ width: 200 }}>
                        {moment(this.state.leaderInfo.birthday).format('YYYY-MM-DD')}
                      </div>
                    </Description>
                  </DescriptionList>
                </Col>
                <Col span={12}>
                  <DescriptionList size="large" title="" style={{ width: '100%', margin: '10px' }}>
                    <Description term="手机号码">
                      <div style={{ width: 200 }}>{this.state.leaderInfo.phoneNumber}</div>
                    </Description>
                  </DescriptionList>
                </Col>
              </Row>

              <Row gutter={{ md: 24, lg: 24, xl: 24 }}>
                <Col span={12}>
                  <DescriptionList size="large" title="" style={{ width: '100%', margin: '10px' }}>
                    <Description term="身份证号">
                      <div style={{ width: 200 }}>{this.state.leaderInfo.idNumber}</div>
                    </Description>
                  </DescriptionList>
                </Col>
                <Col span={12}>
                  <DescriptionList size="large" title="" style={{ width: '100%', margin: '10px' }}>
                    <Description term="学历">
                      <div style={{ width: 200 }}>
                        {EDUCATION_MAP[this.state.leaderInfo.education]}
                      </div>
                    </Description>
                  </DescriptionList>
                </Col>
              </Row>

              <Row gutter={{ md: 24, lg: 24, xl: 24 }}>
                <Col span={12}>
                  <DescriptionList size="large" title="" style={{ width: '100%', margin: '10px' }}>
                    <Description term="所学专业">
                      <div style={{ width: 200 }}>{this.state.leaderInfo.major}</div>
                    </Description>
                  </DescriptionList>
                </Col>
                <Col span={12}>
                  <DescriptionList size="large" title="" style={{ width: '100%', margin: '10px' }}>
                    <Description term="电子邮箱">
                      <div style={{ width: 200 }}>{this.state.leaderInfo.email}</div>
                    </Description>
                  </DescriptionList>
                </Col>
              </Row>

              <Row gutter={{ md: 24, lg: 24, xl: 24 }}>
                <Col span={12}>
                  <DescriptionList size="large" title="" style={{ width: '100%', margin: '10px' }}>
                    <Description term="职称">
                      <div style={{ width: 200 }}>{this.state.leaderInfo.position}</div>
                    </Description>
                  </DescriptionList>
                </Col>
                <Col span={12}>
                  <DescriptionList
                    size="large"
                    title=""
                    style={{ width: '100%', margin: '10px' }}
                  />
                </Col>
              </Row>
            </div>
          )}
          {this.state.smsProject.projectType === 1 && (
            <div>
              <Row gutter={{ md: 24, lg: 24, xl: 24 }}>
                <Col span={12}>
                  <DescriptionList size="large" title="" style={{ width: '100%', margin: '10px' }}>
                    <Description term="姓名">
                      <div style={{ width: 200 }}>{this.state.leaderInfo.leaderName}</div>
                    </Description>
                  </DescriptionList>
                </Col>
                <Col span={12}>
                  <DescriptionList size="large" title="" style={{ width: '100%', margin: '10px' }}>
                    <Description term="性别">
                      <div style={{ width: 200 }}>
                        {this.state.leaderInfo.gender === 1 ? '男' : '女'}
                      </div>
                    </Description>
                  </DescriptionList>
                </Col>
              </Row>

              <Row gutter={{ md: 24, lg: 24, xl: 24 }}>
                <Col span={12}>
                  <DescriptionList size="large" title="" style={{ width: '100%', margin: '10px' }}>
                    <Description term="民族">
                      <div style={{ width: 200 }}>{this.state.leaderInfo.nation}</div>
                    </Description>
                  </DescriptionList>
                </Col>
                <Col span={12}>
                  <DescriptionList size="large" title="" style={{ width: '100%', margin: '10px' }}>
                    <Description term="学历">
                      <div style={{ width: 200 }}>
                        {EDUCATION_MAP[this.state.leaderInfo.education]}
                      </div>
                    </Description>
                  </DescriptionList>
                </Col>
              </Row>

              <Row gutter={{ md: 24, lg: 24, xl: 24 }}>
                <Col span={12}>
                  <DescriptionList size="large" title="" style={{ width: '100%', margin: '10px' }}>
                    <Description term="学位">
                      <div style={{ width: 200 }}>{this.state.leaderInfo.bachelorOfScience}</div>
                    </Description>
                  </DescriptionList>
                </Col>
                <Col span={12}>
                  <DescriptionList size="large" title="" style={{ width: '100%', margin: '10px' }}>
                    <Description term="所在单位及部门">
                      <div style={{ width: 200 }}>{this.state.leaderInfo.department}</div>
                    </Description>
                  </DescriptionList>
                </Col>
              </Row>

              <Row gutter={{ md: 24, lg: 24, xl: 24 }}>
                <Col span={12}>
                  <DescriptionList size="large" title="" style={{ width: '100%', margin: '10px' }}>
                    <Description term="研究专长">
                      <div style={{ width: 200 }}>{this.state.leaderInfo.researchExpertise}</div>
                    </Description>
                  </DescriptionList>
                </Col>
                <Col span={12}>
                  <DescriptionList size="large" title="" style={{ width: '100%', margin: '10px' }}>
                    <Description term="电子邮箱">
                      <div style={{ width: 200 }}>{this.state.leaderInfo.email}</div>
                    </Description>
                  </DescriptionList>
                </Col>
              </Row>

              <Row gutter={{ md: 24, lg: 24, xl: 24 }}>
                <Col span={12}>
                  <DescriptionList size="large" title="" style={{ width: '100%', margin: '10px' }}>
                    <Description term="邮编">
                      <div style={{ width: 200 }}>{this.state.leaderInfo.postcode}</div>
                    </Description>
                  </DescriptionList>
                </Col>
                <Col span={12}>
                  <DescriptionList size="large" title="" style={{ width: '100%', margin: '10px' }}>
                    <Description term="职称">
                      <div style={{ width: 200 }}>{this.state.leaderInfo.position}</div>
                    </Description>
                  </DescriptionList>
                </Col>
              </Row>
            </div>
          )}

          <Divider orientation="left">课题组主要成员</Divider>

          {this.state.topicGroup.map((item, index) => {
            return (
              <div
                style={{
                  border: '1px solid #ccc',
                  marginBottom: 4,
                  position: 'relative',
                  borderRadius: 4,
                }}
              >
                <Row style={{ height: 60, lineHeight: '60px' }}>
                  <Col span={6}>
                    <div className="leftlabel">姓名:</div>
                  </Col>
                  <Col span={6}>
                    <div className="rightitemwrap">
                      <div style={{ width: 200 }}>{item.name}</div>
                    </div>
                  </Col>
                  <Col span={6}>
                    <div className="leftlabel">学历:</div>
                  </Col>
                  <Col span={6}>
                    <div className="rightitemwrap">
                      <div style={{ width: 200 }}>{EDUCATION_MAP[item.education]}</div>
                    </div>
                  </Col>
                </Row>

                <Row style={{ height: 60, lineHeight: '60px' }}>
                  <Col span={6}>
                    <div className="leftlabel">职称:</div>
                  </Col>
                  <Col span={6}>
                    <div className="rightitemwrap">
                      <div style={{ width: 200 }}>{item.title}</div>
                    </div>
                  </Col>
                  <Col span={6}>
                    <div className="leftlabel">电话号码:</div>
                  </Col>
                  <Col span={6}>
                    <div className="rightitemwrap">
                      <div style={{ width: 200 }}>{item.phoneNumber}</div>
                    </div>
                  </Col>
                </Row>

                <Row style={{ height: 60, lineHeight: '60px' }}>
                  <Col span={6}>
                    <div className="leftlabel">身份证号:</div>
                  </Col>
                  <Col span={6}>
                    <div className="rightitemwrap">
                      <div style={{ width: 200 }}>{item.idNumber}</div>
                    </div>
                  </Col>
                  <Col span={6}>
                    <div className="leftlabel">单位名称:</div>
                  </Col>
                  <Col span={6}>
                    <div className="rightitemwrap">
                      <div style={{ width: 200 }}>{item.companyName}</div>
                    </div>
                  </Col>
                </Row>
              </div>
            );
          })}

          <Divider orientation="left">申报单位情况</Divider>

          {this.state.declareUnits.map((item, index) => {
            return (
              <div
                style={{
                  border: '1px solid #ccc',
                  marginBottom: 4,
                  position: 'relative',
                  borderRadius: 4,
                }}
              >
                <Row style={{ height: 60, lineHeight: '60px' }}>
                  <Col span={6}>
                    <div className="leftlabel">单位名称:</div>
                  </Col>
                  <Col span={6}>
                    <div className="rightitemwrap">
                      <div style={{ width: 200 }}>{item.unitsName}</div>
                    </div>
                  </Col>
                  <Col span={6}>
                    <div className="leftlabel">性质:</div>
                  </Col>
                  <Col span={6}>
                    <div className="rightitemwrap">
                      <div style={{ width: 200 }}>{item.unitsCharacter}</div>
                    </div>
                  </Col>
                </Row>

                <Row style={{ height: 60, lineHeight: '60px' }}>
                  <Col span={6}>
                    <div className="leftlabel">社会统一信用代码:</div>
                  </Col>
                  <Col span={6}>
                    <div className="rightitemwrap">
                      <div style={{ width: 200 }}>{item.creditCode}</div>
                    </div>
                  </Col>
                  <Col span={6}>
                    <div className="leftlabel">邮编:</div>
                  </Col>
                  <Col span={6}>
                    <div className="rightitemwrap">
                      <div style={{ width: 200 }}>{item.postcode}</div>
                    </div>
                  </Col>
                </Row>

                <Row style={{ height: 60, lineHeight: '60px' }}>
                  <Col span={6}>
                    <div className="leftlabel">通信地址:</div>
                  </Col>
                  <Col span={18}>
                    <div className="rightitemwrap">
                      <div style={{ width: 200 }}>{item.postalAddress}</div>
                    </div>
                  </Col>
                </Row>
              </div>
            );
          })}

          <Divider orientation="left">合作单位情况</Divider>

          {this.state.cooperationUnits.map((item, index) => {
            return (
              <div
                style={{
                  border: '1px solid #ccc',
                  marginBottom: 4,
                  position: 'relative',
                  borderRadius: 4,
                }}
              >
                <Row style={{ height: 60, lineHeight: '60px' }}>
                  <Col span={6}>
                    <div className="leftlabel">单位名称:</div>
                  </Col>
                  <Col span={6}>
                    <div className="rightitemwrap">
                      <div style={{ width: 200 }}>{item.unitsName}</div>
                    </div>
                  </Col>
                  <Col span={6}>
                    <div className="leftlabel">性质:</div>
                  </Col>
                  <Col span={6}>
                    <div className="rightitemwrap">
                      <div style={{ width: 200 }}>{item.unitsCharacter}</div>
                    </div>
                  </Col>
                </Row>

                <Row style={{ height: 60, lineHeight: '60px' }}>
                  <Col span={6}>
                    <div className="leftlabel">社会统一信用代码:</div>
                  </Col>
                  <Col span={6}>
                    <div className="rightitemwrap">
                      <div style={{ width: 200 }}>{item.creditCode}</div>
                    </div>
                  </Col>
                  <Col span={6}>
                    <div className="leftlabel">邮编:</div>
                  </Col>
                  <Col span={6}>
                    <div className="rightitemwrap">
                      <div style={{ width: 200 }}>{item.postcode}</div>
                    </div>
                  </Col>
                </Row>

                <Row style={{ height: 60, lineHeight: '60px' }}>
                  <Col span={6}>
                    <div className="leftlabel">通信地址:</div>
                  </Col>
                  <Col span={18}>
                    <div className="rightitemwrap">
                      <div style={{ width: 200 }}>{item.postalAddress}</div>
                    </div>
                  </Col>
                </Row>
              </div>
            );
          })}

          <Divider orientation="left">附件</Divider>

          <Row style={{ height: 60, lineHeight: '30px', marginTop: 10 }}>
            <Col span={6}>
              {this.state.smsProject.letterOfCommitment && (
                <a
                  style={{ width: '200px', marginLeft: '40px' }}
                  href={this.state.smsProject.letterOfCommitment}
                >
                  诚信守诺书
                </a>
              )}
            </Col>
            <Col span={6}>
              {this.state.smsProject.writtenOpinions && (
                <a
                  style={{ width: '200px', marginLeft: '40px' }}
                  href={this.state.smsProject.writtenOpinions}
                >
                  申报单位意见书
                </a>
              )}
            </Col>
            <Col span={6}>
              {this.state.smsProject.budgetTable && (
                <a
                  style={{ width: '200px', marginLeft: '40px' }}
                  href={this.state.smsProject.budgetTable}
                >
                  经费预算表
                </a>
              )}
            </Col>
            <Col span={6}>
              {this.state.smsProject.agreementUrls && (
                <a
                  style={{ width: '200px', marginLeft: '40px' }}
                  href={this.state.smsProject.agreementUrls}
                >
                  单位合作协议
                </a>
              )}
            </Col>
          </Row>

          <Divider orientation="left">其他信息</Divider>

          {this.state.smsProject.projectType === 0 && (
            <Tabs
              onChange={this.handleTabsChange.bind(this)}
              activeKey={this.state.step + ''}
              tabPosition={'left'}
            >
              <TabPane tab={'项目意义'} key={3}>
                {this.renderStep3({
                  step: 3,
                  field: 'projectSignificance',
                  title: '项目意义（着重表述实施该项目的必要性和当前自治区经济社会发展急需的程度）',
                })}
              </TabPane>
              <TabPane tab={'技术现状'} key={4}>
                {this.renderStep3({
                  step: 4,
                  field: 'technologyStatus',
                  title:
                    '相关领域国内外技术现状和发展趋势（主要阐明相关领域国内外技术现状、专利等知识产权情况，国内外技术发展趋势等）',
                })}
              </TabPane>
              <TabPane tab={'项目目标'} key={5}>
                {this.renderStep3({
                  step: 5,
                  field: 'projectObjectives',
                  title:
                    '项目目标（项目目标的涵盖范围要与项目名称相对应；确立的项目目标应能切实支撑项目立项的意义；目标应该明确具体，便于考核；其目标在计划实施周期内能够完成。）',
                })}
              </TabPane>
              <TabPane tab={'项目任务'} key={6}>
                {this.renderStep3({
                  step: 6,
                  field: 'projectTasks',
                  title:
                    '项目主要任务（主要包括研究重点与开发内容，项目、人才、基地统筹计划，技术关键、技术难点、创新点、实施计划。其内容应与项目目标有直接对应的支撑关系，为实现项目目标所应进行的重点研究内容不应有遗漏，也不应包括与项目目标关系度不大的内容。）',
                })}
              </TabPane>
              <TabPane tab={'预期前景'} key={7}>
                {this.renderStep3({
                  step: 7,
                  field: 'expectedProspects',
                  title:
                    '项目预期技术、经济、社会效益及推广应用和产业化前景（包括技术、经济、社会效益分析，推广应用与产业化前景分析，可能取得的专利、尤其是发明专利及知识产权分析，项目实施的风险分析。）',
                })}
              </TabPane>
              <TabPane tab={'研究基础'} key={8}>
                {this.renderStep3({
                  step: 8,
                  field: 'researchBasis',
                  title:
                    '项目现有研究工作基础（主要阐述项目成熟性。包括项目申报单位已有的研究开发经历、科研成果、科研条件、人才团队、组织机制和前期准备工作等。）',
                })}
              </TabPane>
              <TabPane tab={'实施方案'} key={9}>
                {this.renderStep3({
                  step: 9,
                  field: 'implementationPlan',
                  title:
                    '必要的支撑条件、组织措施及实施方案（主要阐明为完成该项目相关的保障措施、组织实施方案、管理措施与实施年限；企业参与度、产学研联合机制等。）',
                })}
              </TabPane>
              <TabPane tab={'关联行动'} key={10}>
                {this.renderStep3({
                  step: 10,
                  field: 'linkedAction',
                  title:
                    '项目的关联行动（重点阐述与本项目相关的基本建设、技术改造、技术引进、国际合作等落实情况，本项目与其他相关国家、自治区科技计划项目及其他工程与建设计划项目的衔接和分工。）',
                })}
              </TabPane>
              <TabPane tab={'负责人背景'} key={11}>
                {this.renderStep3({
                  step: 11,
                  field: 'personResume',
                  title: '项目负责人主要工作及科研经历',
                })}
              </TabPane>
            </Tabs>
          )}

          {this.state.smsProject.projectType === 1 && (
            <Tabs
              onChange={this.handleTabsChange.bind(this)}
              activeKey={this.state.step + ''}
              tabPosition={'left'}
            >
              <TabPane tab={'研究基础'} key={3}>
                {this.renderStep3({
                  step: 3,
                  field: 'basicResearch',
                  title: '基础研究（现有专家资源、平台、工作团队等条件）',
                })}
              </TabPane>
              <TabPane tab={'工作方案'} key={4}>
                {this.renderStep3({
                  step: 4,
                  field: 'workPlan',
                  title: '工作方案（项目的主要内容、基本思路和方法、实施计划及有关措施）',
                })}
              </TabPane>
            </Tabs>
          )}
        </Modal>

        <Modal
          style={{ width: '800px' }}
          title={'评审'}
          visible={this.state.checkVisible}
          onOk={this.handleCheckSave.bind(this)}
          onCancel={this.handleCancel2.bind(this, 'checkVisible')}
        >
          <DescriptionList size="large" title="" col="1">
            <Description term="项目打分">
              <Input
                placeholder="0分到100分"
                disabled={this.isReadOnly()}
                value={this.state.score}
                onChange={this.handleOnchange.bind(this, 'score')}
              />
            </Description>
            <Description term="评审意见" termStyle={styles.top}>
              <TextArea
                rows={4}
                disabled={this.isReadOnly()}
                value={this.state.reviewDesc}
                onChange={this.handleOnchange.bind(this, 'reviewDesc')}
              />
            </Description>
          </DescriptionList>
        </Modal>
      </PageHeaderLayout>
    );
  }
}
